<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: yangweijie <yangweijiester@gmail.com> <code-tech.diandian.com>
// +----------------------------------------------------------------------

namespace Addons\Record;
use Common\Controller\Addon;

/**
 * 编辑器插件
 * @author yangweijie <yangweijiester@gmail.com>
 */

	class RecordAddon extends Addon{

		public $info = array(
				'name'=>'Rcord',
				'title'=>'文章加载记录',
				'description'=>'用于单篇文章记载',
				'status'=>1,
				'author'=>'thinkphp',
				'version'=>'0.1'
			);

		public function install(){
			return true;
		}

		public function uninstall(){
			return true;
		}

		/**
		 * 编辑器挂载的文章内容钩子
		 * @param array('name'=>'表单name','value'=>'表单对应的值')
		 */
		public function documentRecord(){
			$id=I('get.id');
			$ip = get_client_ip();
			$art=array(
			    'id'=>$id,
			    'ip'=>$ip
			);
			$s_art=S('art');
			if(!$s_art||$s_art['id']!=$id){
              M("article")->where("aid='{$id}'")->setInc('click',1,60);
		     S("art",$art,60*10);
			}
		}


	}
